$OpenBSD: patch-sapi_cgi_cgi_main_c,v 1.3 2015/03/21 22:33:01 sthen Exp $
--- sapi/cgi/cgi_main.c.orig.port	Thu Mar 19 00:19:30 2015
+++ sapi/cgi/cgi_main.c	Fri Mar 20 14:18:19 2015
@@ -1749,6 +1749,7 @@ int main(int argc, char *argv[])
 	char *orig_optarg = php_optarg;
 	char *script_file = NULL;
 	int ini_entries_len = 0;
+	char *ini;
 	/* end of temporary locals */
 
 #ifdef ZTS
@@ -1803,7 +1804,12 @@ int main(int argc, char *argv[])
 
 	sapi_startup(&cgi_sapi_module);
 	fastcgi = fcgi_is_fastcgi();
-	cgi_sapi_module.php_ini_path_override = NULL;
+
+	if ((ini = getenv("PHP_INI_PATH"))) {
+		cgi_sapi_module.php_ini_path_override = ini;
+	} else {
+		cgi_sapi_module.php_ini_path_override = NULL;
+	}
 
 #ifdef PHP_WIN32
 	_fmode = _O_BINARY; /* sets default for file streams to binary */
